//
//  FirstView.m
//  lovergotest
//
//  Created by liudonghuan on 14-8-12.
//  Copyright (c) 2014年 liudonghuan. All rights reserved.
//

#import "TuiJianHuoDongView.h"

@implementation TuiJianHuoDongView
@synthesize tjhdDelegate = _tjhdDelegate;
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //主页面
        _mainView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, frame.size.width, SCREEN_HEIGHT)];
        _tableViewleft = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-2*TOPBAR-STATUSBAR-BOTTOMBAR+10)];
        _tableViewleft.backgroundColor = [UIColor whiteColor];
        _tableViewright = [[UITableView alloc] initWithFrame:CGRectMake(320, 0, SCREEN_WIDTH, SCREEN_HEIGHT-2*TOPBAR-STATUSBAR-BOTTOMBAR+10)];
        _tableViewleft.tag = 0;
        _tableViewleft.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableViewright.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableViewright.backgroundColor = [UIColor whiteColor];
        _tableViewright.tag = 1;
        //滚动视图
        _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, TOPBAR-10, SCREEN_WIDTH, SCREEN_HEIGHT-BOTTOMBAR)];
        //长度0不能垂直滚了
        _scrollView.contentSize = CGSizeMake(SCREEN_WIDTH*2, 0);
        _scrollView.backgroundColor = [UIColor whiteColor];
        _scrollView.pagingEnabled = YES;//控制是否整页翻动
        //滚动视图标签
        //低栏颜色
        _topline = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 5)];
        _topline.image = [UIImage imageNamed:@"top_black_line.png"];
        _tjBtn = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/2, TOPBAR-10)];
        [_tjBtn setTitle:@"主题" forState:UIControlStateNormal];
        [_tjBtn setTitleColor:[UIColor colorWithRed:102/255.0 green:221/255.0 blue:238/255.0 alpha:1] forState:UIControlStateNormal];
        [_tjBtn setBackgroundImage:[UIImage imageNamed:@"firstview_blueline.png"] forState:UIControlStateNormal];
        _tjBtn.titleLabel.font = [UIFont fontWithName:@"Thonburi-Bold" size:16];
        
        [_tjBtn setTag:TuiJianBtn];
        [_tjBtn addTarget:self action:@selector(whichLABClick:) forControlEvents:UIControlEventTouchUpInside];
        _hdBtn = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2, 0, SCREEN_WIDTH/2, TOPBAR-10)];
        [_hdBtn setTitle:@"活动" forState:UIControlStateNormal];
        [_hdBtn setTitleColor:[UIColor colorWithRed:102/255.0 green:221/255.0 blue:238/255.0 alpha:1] forState:UIControlStateNormal];
        _hdBtn.titleLabel.font = [UIFont fontWithName:@"Thonburi-Bold" size:16];
        [_hdBtn setTag:HuoDongBtn];
        [_hdBtn addTarget:self action:@selector(whichLABClick:) forControlEvents:UIControlEventTouchUpInside];
        [_scrollView addSubview:_tableViewleft];
        [_scrollView addSubview:_tableViewright];
        [_mainView addSubview:_scrollView];
        [_mainView addSubview:_tjBtn];
        [_mainView addSubview:_hdBtn];
        [_mainView addSubview:_leftbutton];
        [_mainView addSubview:_topline];
        [self addSubview:_mainView];
        
    }
    return self;
}
-(void)whichLABClick:(UIButton *)Btn{
    [_tjhdDelegate ChangeViewWith:self whichLabel:(whichLabel)Btn.tag];
}

@end
